package wowraidmanager.shared.model.wishlist;

import java.io.Serializable;
import java.util.ArrayList;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;

import com.google.appengine.api.datastore.Key;

@Model(schemaVersion = 1)
public class Member implements Serializable{

    private static final long serialVersionUID = 1L;

    @Attribute(primaryKey = true)
    private Key key;

    @Attribute(version = true)
    private Long version;

    private String memberName;

    private String memberAccount;

    private String guild;

    private String realm;

    private String membertype;

    private long order;

    @Attribute(lob = true)
    private ArrayList<Droplist> wishlist;

    /**
     * Returns the key.
     *
     * @return the key
     */
    public Key getKey(){
        return key;
    }

    /**
     * Sets the key.
     *
     * @param key
     *            the key
     */
    public void setKey(Key key){
        this.key = key;
    }

    /**
     * Returns the version.
     *
     * @return the version
     */
    public Long getVersion(){
        return version;
    }

    /**
     * Sets the version.
     *
     * @param version
     *            the version
     */
    public void setVersion(Long version){
        this.version = version;
    }

    public String getMemberName(){
        return memberName;
    }

    public void setMemberName(String memberName){
        this.memberName = memberName;
    }

    public String getMemberAccount(){
        return memberAccount;
    }

    public void setMemberAccount(String memberAccount){
        this.memberAccount = memberAccount;
    }

    public String getGuild(){
        return guild;
    }

    public void setGuild(String guild){
        this.guild = guild;
    }

    public void setRealm(String realm){
        this.realm = realm;
    }

    public String getRealm(){
        return realm;
    }

    public String getMembertype(){
        return membertype;
    }

    public void setMembertype(String membertype){
        this.membertype = membertype;
    }

    public void setOrder(long order){
        this.order = order;
    }

    public long getOrder(){
        return order;
    }

    public ArrayList<Droplist> getWishlist(){
        return wishlist;
    }

    public void setWishlist(ArrayList<Droplist> wishlist){
        this.wishlist = wishlist;
    }

    @Override
    public int hashCode(){
        final int prime = 31;
        int result = 1;
        result = prime * result + ((key == null) ? 0:key.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj){
        if(this == obj){
            return true;
        }
        if(obj == null){
            return false;
        }
        if(getClass() != obj.getClass()){
            return false;
        }
        Member other = (Member)obj;
        if(key == null){
            if(other.key != null){
                return false;
            }
        }else if( ! key.equals(other.key)){
            return false;
        }
        return true;
    }
}
